﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.CCoTcNewObjectCmd
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System.Collections.ObjectModel;
using System.Resources;
using System.Windows.Forms;
using Tecnomatix.Engineering;
using Tecnomatix.Engineering.Ui;


namespace DnProcessSimulateCommands;

public class CCoTcNewObjectCmd : TxButtonCommand
{
  private CApTcNewObjectEnabler m_enabler;

  public CCoTcNewObjectCmd()
  {
    TxTypeFilter filter = new TxTypeFilter();
    filter.AddIncludedType(typeof (TxTcProcess));
    filter.AddIncludedType(typeof (TxTcActivity));
    filter.AddIncludedType(typeof (TxCompoundResource));
    filter.AddIncludedType(typeof (TxLogicalCollection));
    filter.AddIncludedType(typeof (TxTcOperation));
    filter.AddIncludedType(typeof (ITxComponent));
    this.m_enabler = new CApTcNewObjectEnabler((ITxTypeFilter) filter);
  }

  public virtual void Execute(object cmdParams)
  {
    ITxObject parent = ((Collection<ITxObject>) TxApplication.ActiveSelection.GetItems())[0];
    CApTcNewObject apTcNewObj = new CApTcNewObject(parent);
    if (apTcNewObj.GetTypesToDisplay().Count > 0)
    {
      int num1 = (int) ((Form) new CUiTcNewObjectForm(parent, apTcNewObj)).ShowDialog();
    }
    else
    {
      int num2 = (int) TxMessageBox.ShowModal(string.Format(StringTable.NEW_OBJECT_CMD_NO_VALID_CHILD_TYPES), base.Name, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
    }
  }

  public virtual string Bitmap => "new_obj_PS_on_TC.bmp";

  public virtual string LargeBitmap => "new_obj_PS_on_TC_LARGE.png";

  public virtual ITxImage Image => (ITxImage) TxImageManager.GetImageByKey("NewObject");

  public virtual string Category => this.GetResourceManager().GetString("NEW_OBJECT_CMD_CATEGORY");

  public virtual string Description
  {
    get => this.GetResourceManager().GetString("NEW_OBJECT_CMD_DESCRIPTION");
  }

  public virtual string Name => this.GetResourceManager().GetString("NEW_OBJECT_CMD_NAME");

  public virtual string Tooltip => this.GetResourceManager().GetString("NEW_OBJECT_CMD_TOOLTIP");

  public virtual ITxCommandEnabler CommandEnabler => (ITxCommandEnabler) this.m_enabler;

  private ResourceManager GetResourceManager()
  {
    return new ResourceManager("DnProcessSimulateCommands.StringTable", ((object) this).GetType().Assembly);
  }

  public virtual string[] AdvancedDescriptions => TxCallMessages.CollectMessages((ITxCommand) this);
}
